import { Bus } from "../Bus";
import { Common } from "../Common";
import { BeanUtil } from "../util/BeanUtil";


export class UserService {
    addScore () {

        // Bus
        if (Bus.curUser == null) {
            // 需要登录

        }
        // BeanUtil
        var user = BeanUtil.clone(Bus.curUser)
        user.score++
        // userSave
        http.post(Common.baseUrl,"/user/update", null, user, (err, ret) => {
            if (err) {
                console.log(err);
                return;
            }

            console.log(ret);
            // ret.data
            // Common
            if (ret.code == Common.codeSuccess) {
                Bus.curUser = ret.data
                return
            }
            console.log("ret.msg");
            console.log(ret.msg);
        })
    }
}
